package com.lucanjun.cn.springboot.multipledatasources.common.exception;

import com.lucanjun.cn.springboot.multipledatasources.common.result.HttpResultCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lucanjun
 * @version 1.0.0
 * @title BusinessException
 * @create 2024-12-19 16:55:19
 * @description 自定义异常处理类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusinessException extends RuntimeException {

    private Integer code;
    private String message;

    public BusinessException(HttpResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

}
